<clr-datagrid (clrDgRefresh)="refresh($event)" class="wayne-clr-datagrid">
  <clr-dg-placeholder>暂无数据</clr-dg-placeholder>
  <clr-dg-column [clrDgField]="'id'" class="col-id">
    <ng-container>
      ID
    </ng-container>
  </clr-dg-column>
  <clr-dg-column [clrDgSortBy]="'createTime'" class="col-time">
    <ng-container *clrDgHideableColumn="showState['创建时间']">
      创建时间
    </ng-container>
  </clr-dg-column>
  <clr-dg-column class="col-version">
    <ng-container *clrDgHideableColumn="showState['版本']">
      版本
    </ng-container>
  </clr-dg-column>
  <!-- 防止事件图标换行-->
  <clr-dg-column class="col-cluster">
    <ng-container *clrDgHideableColumn="showState['上线机房']">
      上线机房
    </ng-container>
  </clr-dg-column>
  <clr-dg-column [clrDgField]="'description'" class="col-description">
    <ng-container *clrDgHideableColumn="showState['发布说明']">
      发布说明
    </ng-container>
  </clr-dg-column>
  <clr-dg-column [clrDgField]="'user'">
    <ng-container *clrDgHideableColumn="showState['创建者']">
      创建者
    </ng-container>
  </clr-dg-column>
  <!-- 防止操作图标换行-->
  <clr-dg-column class="col-operate">
    <ng-container *clrDgHideableColumn="showState['操作']">
      操作
    </ng-container>
  </clr-dg-column>
  <clr-dg-row *ngFor="let deploymentTpl of deploymentTpls" [clrDgItem]="deploymentTpl">
    <clr-dg-cell class="col-id">{{deploymentTpl.id}}</clr-dg-cell>
    <clr-dg-cell class="col-time">{{deploymentTpl.createTime | date:'yyyy-MM-dd HH:mm:ss'}}</clr-dg-cell>
    <clr-dg-cell class="col-version">
      <div *ngFor="let version of deploymentTpl.containerVersions" class="version-text">
          <a href="javascript:;" (click)="versionDetail(version)">{{version}}</a>
      </div>
    </clr-dg-cell>
    <clr-dg-cell class="col-cluster">
      <div class="form-group" style="padding-bottom: 2px"
           *ngFor="let status of deploymentTpl.status">
        <a href="javascript:void(0)" (click)="listPod(status,deploymentTpl)" class="label clickable"
           [class.clickable]="status.state!=2"
           [class.label-success]="status.state==0"
           [class.label-warning]="status.state==1">
          {{status.cluster}}
          <span *ngIf="status.desired">({{status.current}}/{{status.desired}})</span>
        </a>
        <a href="javascript:void(0)"
           *ngIf="status.warnings"
           (click)="listEvent(status.warnings)"
           style="color:#a32100">
          <clr-icon shape="error-standard"></clr-icon>
        </a>
      </div>
    </clr-dg-cell>
    <clr-dg-cell class="col-description">
      <div class="text-overflow"><a href="javascript:void(0)" (click)="tplDetail(deploymentTpl)">{{deploymentTpl.description}}</a>
      </div>
    </clr-dg-cell>
    <clr-dg-cell>{{deploymentTpl.user}}</clr-dg-cell>
    <clr-dg-cell class="col-operate">
      <button class="wayne-button text"
         (click)="publishTpl(deploymentTpl)"
         *ngIf="authService.currentAppPermission.deployment.deploy || authService.currentUser.admin">
         发布</button>
      <button class="wayne-button text"
         (click)="restartDeployment(deploymentTpl)"
         *ngIf="deploymentTpl.status && (authService.currentAppPermission.deployment.deploy || authService.currentUser.admin)">
         重启</button>
      <button class="wayne-button text"
         (click)="deploymentTplDetail(deploymentTpl)"
         *ngIf="authService.currentAppPermission.deployment.read || authService.currentUser.admin">
         详情</button>
      <button class="wayne-button text"
         (click)="cloneDeploymentTpl(deploymentTpl)"
         *ngIf="authService.currentAppPermission.deployment.create || authService.currentUser.admin">
         克隆</button>
      <button class="wayne-button text"
         *ngIf="!deploymentTpl.status && (authService.currentAppPermission.deployment.delete || authService.currentUser.admin)"
         (click)="deleteDeploymentTpl(deploymentTpl)">
         删除</button>
      <button class="wayne-button text"
         (click)="offlineDeployment(deploymentTpl)"
         *ngIf="deploymentTpl.status && (authService.currentAppPermission.deployment.offline || authService.currentUser.admin)">
         下线</button>
    </clr-dg-cell>
  </clr-dg-row>


  <wayne-paginate
    [(currentPage)]="currentPage"
    [total]="page.totalCount"
    [pageSizes]="[10, 20, 50]"
    (sizeChange)="pageSizeChange($event)"
  >
  </wayne-paginate>
</clr-datagrid>
<list-event></list-event>
<list-pod></list-pod>
<wayne-ace-editor></wayne-ace-editor>

<publish-tpl (published)="published($event)"></publish-tpl>
